<?php
include('../class/class_connect.php');
include('class/class_mobilepage.php');
include('class/class_comments.php');
include('class/class_news.php');
include('class/class_address.php');
include('../class/class_workdays.php');
include('../class/class_rating.php');
include('../class/class_acts.php');
include('class/abstract/class_mainObjectInfo.php');
include('../class/city_rus.php');
include('../class/class_checkGetData.php');

$comments=new comments('firms', $_GET['city'], $_GET['id']);
$comments->addComment();

$aConnect=new connect('f');
$row=mysql_fetch_array($aConnect->select_all($_GET['city'], "WHERE id='".$_GET['id']."'"));

class aFirmPage extends page
{
    var $row=array();
    var $cityRus;
	function __construct($row=array())
	{
		$this->cityRus=new city_rus_class();
        $this->row=$row;
		parent::__construct();
	}
	function title()
	{
    	echo $this->row['name'].' '.$this->cityRus->city_rus_im($_GET['city']);
	}
	function maincontent()
	{
		$comments=new comments('firms', $_GET['city'], $_GET['id']);
		$comments->addStyle();
		$aNews=new news('firms', $_GET['city'], $_GET['id']);
		$aNews->addStyle();
		echo ('
		<script type="text/javascript" src="scripts/mobtabs.js">
		</script>
		<link rel="stylesheet" type="text/css" href="style/mobtabs.css" />
		<input id="cityValue" type="hidden" value="'.$_GET['city'].'">
		<input id="idValue" type="hidden" value="'.$_GET['id'].'">
		<input id="pageName" type="hidden" value="firms">
		<div class="route">
			<div class="routeEl">
				<a href="division.php?city='.$_GET['city'].'&division='.$this->row['division'].'">'.$this->row['division'].'</a>
			</div>
			<div class="routeEl">
				<a href="firms_list.php?city='.$_GET['city'].'&subdiv='.$this->row['subdiv'].'">'.$this->row['subdiv'].'</a>
			</div>
			<div class="routeEl">
				'.$this->row['name'].'
			</div>
		</div>
		');
		$main=new mainInfo($this->row);
    	echo ('
    	<input name="city" id="cityHidden" type="hidden" value="'.$_GET['city'].'">
    	<input name="id" id="idHidden" type="hidden" value="'.$_GET['id'].'">
    	<div class="labels">
	    	<div class="label" id="1">
	    		О фирме
	    	</div>
	    	<div class="label" id="2">
	    		Новости
	    	</div>
	    	<div class="label" id="3">
	    		События
	    	</div>
	    	<div class="label" id="4">
	    		Цены
	    	</div>
	    	<div class="activeLabel" id="5">
	    		Отзывы
	    	</div>
    	</div>
    	<div class="space">
    	</div>
    	<div class="subcontent">
    	');
    	$aConnect=new connect('fc');
		$num=mysql_num_rows($aConnect->select_all($_GET['city'], "WHERE f_id='".$_GET['id']."'"));
		echo ('<input name="comNum" id="comNum" type="hidden" value="'.$num.'">');
		$comments=new comments('f', $_GET['city'], $_GET['id']);
		$comments->addStyle();
		$comments->commentForm($_SESSION['login']);
		$comments->showComments(10);
    	echo ('
	    	<div class="end">
	    	</div>
    	</div>
    	');
	}
}

class mainInfo extends mainObjectInfo
{
	var $row=array();
	function __construct($row=array())
	{
		$this->row=$row;
		parent::__construct();
	}
	function showPic()
	{
		echo ('
		<img class="pic" src="http://pro-gorod.com/pictures/firmspics/'.$_GET['city'].'/'.$this->row['id'].'.jpg" title="'.$this->name.'">
		');
	}
	function showAddress()
	{
		$address=new address();
		$address->showSeveralAddresses($this->row['address'], $this->row['link']);
	}
	function showName()
	{
		echo $this->row['name'];
	}
	function showShort()
	{
		echo $this->row['short'];
	}
	function showRating()
	{
		$aFirmRating=new rating('f');
		$aFirmRating->echo_rating(0, $this->row['rating'], $this->row['votes']);
	}
}

$aPage=new aFirmPage($row);

?>